package com.eve.service.impl;

import com.eve.entity.BlogCategory;
import com.eve.mapper.BlogCategoryMapper;
import com.eve.service.BlogCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class BlogCategoryServiceImpl implements BlogCategoryService {

    @Autowired
    private BlogCategoryMapper blogCategoryMapper;
    @Transactional
    @Override
    public int saveCategory(BlogCategory blogCategory) {
        return blogCategoryMapper.saveCategory(blogCategory);
    }
    @Transactional
    @Override
    public BlogCategory getCategory(Integer id) {
        return blogCategoryMapper.getCategory(id);
    }
    @Transactional
    @Override
    public List<BlogCategory> getAllCategory() {
        return blogCategoryMapper.getAllCategory();
    }
    @Transactional
    @Override
    public BlogCategory getCategoryByName(String name) {
        return blogCategoryMapper.getCategoryByName(name);
    }
    @Transactional
    @Override
    public int updateCategory(BlogCategory category) {
        return blogCategoryMapper.updateCategory(category);
    }
    @Transactional
    @Override
    public void deleteCategory(Integer id) {
        blogCategoryMapper.deleteCategory(id);
    }
}
